Layer
A layer is an optionally named collection of sprites and tiles that is a part of Levels. Layers have a rectangular bounds that is defined by the positioning of the tiles within the layer. Layers also have an "anchor point" which can be used to translate the position of all the objects within the layer and tie the layer to Paths. Tiles and Sprites A layer contains a collection of tiles and a collection of sprites. Tiles are tied to the layer and can only be removed by event scripts. The positioning of tiles determines the bounding area of the layer. Sprites are contained within the layer. Sprites do not contribute to the bounds of the rectangle. Sprites will be moved if the layer is moved. If a sprite falls out of the layer's bounds, it is removed from the layer and is no longer affected by the layer's movement or other actions to the layer. If a sprite falls into another layer's bounds, it will be added to the sprites of that layer. If a sprite already within a layer enters the bounds of another layer, the sprite will remain in the first layer and will not be affected by the second. Bounds The bounds of a layer is a rectangle that is defined by the tiles within the layer. The left edge is defined by the left edge of the leftmost tile, the top edge is defined by the top edge of the topmost tile, and so on. Adding or removing tiles to a layer can change the layer's bounds. Anchor Point The anchor point is a point along the edge of the layer's bounds that can be used to move the layer. The anchor can be at any of the following locations within the bounds: top left, top center, top right, right center, bottom right, bottom center, bottom left, left center, and center. Anchor points can also be used along paths to move the layer along the path. Sprite Collision Sprites ordinarily move with the layer as it moves, but collision resolution takes priority. If a sprite is walking along a flat row of tiles in a moving layer, the sprite will be resolved up and it will walk in its normal direction while being moved by the motion of the layer. However, if the layer begins to move into a wall (layers do not collide, nor do tiles collide with layers or other tiles), the sprite will collide with the wall and be forced off the layer. Players Players interact with layers like sprites do. Layer Actions Layers have many actions that can be applied to them, usually through event scripts. *'Translation' or Teleportation: The layer is immediately moved to a given absolute or relative position. *'Movement': The layer can be moved at a certain velocity at a given angle forever or for a certain amount of time. Additionally, the layer can be tied to a path and moved along it. *'Deactivation': The layer and all its objects become invisible and stop updating. Players are not deactivated, but they are removed from the layer. No other sprites can be added to this layer by simple bounds collision, but tiles and sprites can be added and removed through event scripting. Inactive layers will stop moving, but they can be translated, and they will start moving once reactivated. *'Activation:' The layer and all its objects become visible and start updating. The layer will start moving again if its still on its path (pathless moving will always resume). Players and any other sprites within the layer will be added to the layer upon its activation. Main Layer All levels have at least one layer - the Main Layer. This layer behaves differently from other layers - its bounds are defined by level properties. It can't be translated or moved, nor can it be deactivated. All tiles and sprites not in their own layer are part of the main layer, and sprites that fall out of layer bounds are added to the main layer.